/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itsc.ds2.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Eli
 */
@Entity
@Table(name = "saledetails")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SaleDetails.findAll", query = "SELECT s FROM SaleDetails s"),
    @NamedQuery(name = "SaleDetails.findByIdsailDetail", query = "SELECT s FROM SaleDetails s WHERE s.idsailDetail = :idsailDetail"),
    @NamedQuery(name = "SaleDetails.findByAmount", query = "SELECT s FROM SaleDetails s WHERE s.amount = :amount"),
    @NamedQuery(name = "SaleDetails.findByLineTotal", query = "SELECT s FROM SaleDetails s WHERE s.lineTotal = :lineTotal")})
public class SaleDetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idsailDetail")
    private Integer idsailDetail;
    @Basic(optional = false)
    @NotNull
    @Column(name = "amount")
    private int amount;
    @Basic(optional = false)
    @NotNull
    @Column(name = "lineTotal")
    private float lineTotal;
    @JoinColumn(name = "idDisc", referencedColumnName = "idDisc")
    @ManyToOne(optional = false)
    private Discs idDisc;

    public SaleDetails() {
    }

    public SaleDetails(Integer idsailDetail) {
        this.idsailDetail = idsailDetail;
    }

    public SaleDetails(Integer idsailDetail, int amount, float lineTotal) {
        this.idsailDetail = idsailDetail;
        this.amount = amount;
        this.lineTotal = lineTotal;
    }

    public Integer getIdsailDetail() {
        return idsailDetail;
    }

    public void setIdsailDetail(Integer idsailDetail) {
        this.idsailDetail = idsailDetail;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public float getLineTotal() {
        return lineTotal;
    }

    public void setLineTotal(float lineTotal) {
        this.lineTotal = lineTotal;
    }

    public Discs getIdDisc() {
        return idDisc;
    }

    public void setIdDisc(Discs idDisc) {
        this.idDisc = idDisc;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idsailDetail != null ? idsailDetail.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SaleDetails)) {
            return false;
        }
        SaleDetails other = (SaleDetails) object;
        if ((this.idsailDetail == null && other.idsailDetail != null) || (this.idsailDetail != null && !this.idsailDetail.equals(other.idsailDetail))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.itsc.ds2.model.SaleDetails[ idsailDetail=" + idsailDetail + " ]";
    }
    
}
